package com.vvvtimes.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * *
 */
@AllArgsConstructor
@Getter
public enum PluginVersionCodeEnum {
    //处理getcode 方法空指针异常
    PLUGIN_VERSION_CODE_2024_1_1("2024.1.1", "io.github.kings1990.plugin.fastrequest.view.component.tree.LicenseCode", "getCode"),
    PLUGIN_VERSION_CODE_2023_2_3_1("2023.2.3.1", "io.github.kings1990.plugin.fastrequest.cofig.lanuge", "getCode"),
    PLUGIN_VERSION_CODE_2023_2_3("2023.2.3", "io.github.kings1990.plugin.fastrequest.cofig.lanuge", "getCode"),
    PLUGIN_VERSION_CODE_2023_2_2_4("2023.2.2.4", "io.github.kings1990.plugin.fastrequest.cofig.MD5", "getCode"),
    PLUGIN_VERSION_CODE_2023_2_2_3("2023.2.2.3", "io.github.kings1990.plugin.fastrequest.cofig.throws", "getCode"),
    PLUGIN_VERSION_CODE_2023_2_2_2("2023.2.2.2", "io.github.kings1990.plugin.fastrequest.cofig.throws", "getCode"),
    PLUGIN_VERSION_CODE_2023_2_2_1("2023.2.2.1", "io.github.kings1990.plugin.fastrequest.cofig.throws", "getCode"),
    PLUGIN_VERSION_CODE_DEFAULT("default", "", ""),

    ;
    private String version;
    private String className;
    private String methodName;

    public static PluginVersionCodeEnum fromCode(String code) {
        PluginVersionCodeEnum[] statuses = PluginVersionCodeEnum.values();
        for (PluginVersionCodeEnum versionEnum : statuses) {
            if (versionEnum.getVersion()
                    .equals(code)) {
                return versionEnum;
            }
        }
        return PLUGIN_VERSION_CODE_DEFAULT;
    }
}
